package com.ysd.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ysd.util.Result;

@RestController
@RequestMapping("user")
public class UserController {
	
	@RequestMapping("loginUser")
	public Object Login(String name,String pwd,HttpSession session,HttpServletResponse response) throws IOException {
		System.out.println(1);
		if(name!=null && "admin".equals(name)) {
			if(pwd!=null && "123456".equals(pwd)) {
				session.setAttribute("user",name);
				return Result.toClient("0", "登录成功",null);
			}else {
				return Result.toClient("1", "账号密码错误",null);
			}
		}else {
			return Result.toClient("1", "账号密码错误",null);
		}
	}
}
